import jdk.nashorn.internal.ir.IfNode;

/**
 * @author kaho
 * @since 2021/3/2
 */
public class _304_二维区域和检索_矩阵不可变 {


    class NumMatrix {
        int[][] matrix;
//        int row;
//        int col;
        public NumMatrix(int[][] matrix) {
            this.matrix = matrix;
//            row = matrix.length;
//            if (row != 0){
//                col = matrix[0].length;
//            }
        }

        public int sumRegion(int row1, int col1, int row2, int col2) {
            int result = 0;
            for (int row = row1; row <= row2; row++) {
                for (int col = col1; col <= col2; col++) {
                    result+=matrix[row][col];
                }
            }
            return result;
        }
    }
}
